from django.db import models
from google.appengine.ext import db

# Create your models here.

class Groups(db.Model):
    group_name = db.StringProperty()
    
class ZipiUser(db.Model):
    name = db.StringProperty()
    groups = db.ListProperty(db.Key)

class PuntoIberdrola(db.Model):
    audit_dt_created = db.DateTimeProperty(auto_now_add=True)
    name = db.StringProperty(required=True)
    zipcode = db.StringProperty()
    gpPos = db.GeoPtProperty()
    audit_dt_updated = db.DateTimeProperty()

class ZipCode(db.Model):
    name = db.StringProperty()
    zipcode = db.StringProperty(multiline=True)
    provincia = db.StringProperty(multiline=True)
    municipio = db.StringProperty(multiline=True)
    gpPos = db.GeoPtProperty()
    assigned_pto = db.StringProperty()
    audit_dt_created = db.DateTimeProperty(auto_now_add=True)
    audit_dt_updated = db.DateTimeProperty()

class Distances(db.Model):
    audit_dt_created = db.DateTimeProperty(auto_now_add=True)
    distance = db.IntegerProperty()
    zipcode = db.ReferenceProperty(ZipCode, collection_name = 'distances')
    pto_iberdrola = db.StringProperty()

class Load(db.Model):
    loadName = db.StringProperty()
    total = db.IntegerProperty()
    total_processed = db.Property()     
    
